package com.vodone.v1pin.detail.service
{
	import com.vodone.v1pin.ServiceProvider;
	import com.vodone.v1pin.core.service.HttpJsonDelegate;
	import com.vodone.v1pin.core.utils.GoodsUtil;
	import com.vodone.v1pin.detail.vo.ProductDetailVO;
	import com.vodone.v1pin.productlist.vo.QueryItemVO;
	
	import flash.utils.setTimeout;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.http.mxml.HTTPService;

	public class ProductDelegate
	{
		public function ProductDelegate()
		{
		}
		
		public static function addDaohuo( uid:String , itemid:String , phone:String , email:String , memo:String , 
										  resultHandler:Function , faultHandler:Function ):void
		{
			var service:HTTPService = ServiceProvider.getInstance().addDaohuoService;
			var params:Object = {
				userid: uid,
				itemid: itemid, 
				phone: phone,
				useremail: email,
				meno:memo
			};
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
		
		CONFIG::isReal
		public static function getProductDetail( id:String , resultHandler:Function ,  faultHandler:Function = null):void
		{
			var service:HTTPService = ServiceProvider.getInstance().getProductDetailService;
			var params:Object = {
				id : id
			}
			
			var delegate:HttpJsonDelegate = new HttpJsonDelegate( service );
			delegate.send( params , resultHandler , faultHandler );
		}
		CONFIG::isMock
		public static function getProductDetail( id:String , resultHandler:Function ,  faultHandler:Function = null):void
		{
			var picList:Array = [
				"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg",
				"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg",
				"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg",
				"http://i2.ihaveu.net.cn/image/auction/product/000/400/011/major_pic/f1ccf240.jpg.thumb145.jpg",
				"http://i1.ihaveu.net.cn/image/auction/product/000/400/441/major_pic/14d9576b.jpg.thumb145.jpg",
				"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg",
				"http://i3.ihaveu.net.cn/image/auction/product/004/010/853/major_pic/3124c6bd.jpg.thumb145.jpg",
				"http://i3.ihaveu.net.cn/image/auction/product/003/999/324/major_pic/76a13acb.jpg.thumb145.jpg",
			]
			var detail:ProductDetailVO = new ProductDetailVO();
			detail.id = id;
			detail.isFavor = GoodsUtil.haveCollect( id );
			detail.number = "123456";
			detail.name = "Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包";
			detail.salePrice = 5000;
			detail.price = 6000;
			detail.mainPic = new QueryItemVO({extend:picList[ Math.floor(Math.random() * 6)]});
			detail.v1pinPrice = 5500;
			detail.sizeColumns = null;
//			detail.sizeColumns = new ArrayCollection(["裙长","腰围","肩宽","胸围","袖长"]);
			detail.sizeDetailList = new ArrayCollection([
				{p0:"36",p1:"XXL",p2:"100",p3:"60",p4:"31",p5:"68",p6:"66"},
				{p0:"42",p1:"M",p2:"104",p3:"72",p4:"35",p5:"82",p6:"69"},
			]);
			detail.color = new QueryItemVO({ id:"11" , label:"橙红色",extend:"0xff000"});
			detail.colorList = new ArrayCollection([
				new QueryItemVO({ id:"11",label:"橙红色", extend:"23456"}),
				new QueryItemVO({ id:"12",label:"绿色", extend:"192423"}),
			]);
			detail.sizelist = new ArrayCollection([
				new QueryItemVO({ id:"1",label:"M", extend:"20"}),
				new QueryItemVO({ id:"2",label:"ML", extend:"2"}),
				new QueryItemVO({ id:"3",label:"XL", extend:"0"}),
			]);
//			detail.video = "http://i1.ihaveu.net.cn/image/auction/video/000/002/001/mp4/ee39a1ccc9983282e58527755014c854.mp4";
			detail.video = null;
			detail.picList = new ArrayCollection([
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni1"}),
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni1"}),
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni1"}),
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni1"}),
				new QueryItemVO({extend:"http://i2.ihaveu.net.cn/image/auction/product/000/400/011/major_pic/f1ccf240.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni2"}),
				new QueryItemVO({extend:"http://i1.ihaveu.net.cn/image/auction/product/000/400/441/major_pic/14d9576b.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni3"}),
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni4"}),
				new QueryItemVO({extend:"http://i3.ihaveu.net.cn/image/auction/product/004/010/853/major_pic/3124c6bd.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni5"}),
				new QueryItemVO({extend:"http://i3.ihaveu.net.cn/image/auction/product/003/999/324/major_pic/76a13acb.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni6"}),
			]);
			detail.sizePic = "http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg";
			detail.brandDspt = "Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包";
			detail.dsptl = "Barda黑色尼龙材质简约皮质镶边金色logo女士单肩Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包Barda黑色尼龙材质简约皮质镶边金色logo女士单肩包";
			detail.detailList = new ArrayCollection([
				new QueryItemVO({label:"材料", extend:"84%聚酯纤维，16%弹性纤维"}),
				new QueryItemVO({label:"洗涤说明", extend:"不可氯洗，不能干洗，不能熨烫"}),
				new QueryItemVO({label:"产地", extend:"江苏"}),
			]);
			detail.recommendList = new ArrayCollection([
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni0"}),
				new QueryItemVO({extend:"http://i2.ihaveu.net.cn/image/auction/product/000/400/011/major_pic/f1ccf240.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni1"}),
				new QueryItemVO({extend:"http://i1.ihaveu.net.cn/image/auction/product/000/400/441/major_pic/14d9576b.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni2"}),
				new QueryItemVO({extend:"http://i0.ihaveu.net.cn/image/auction/product/004/010/631/major_pic/d60f0391.jpg.thumb145.jpg", label:"2012年春夏新款Bally Ostuni保龄球袋Bally Ostuni3"}),
			]);
			
			setTimeout( resultHandler , 500 , detail  );
		}
	}
}